package com.shao.utils.date;

import lombok.extern.slf4j.Slf4j;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author PaoFu
 * @version 1.0
 * @data 2025/4/27 16:16
 */
@Slf4j
public class DateUtils {

    public static long getTime(String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date = null;
        try {
            date = sdf.parse(pattern);
        } catch (ParseException e) {
            log.error("获取时间戳失败");
            throw new RuntimeException(e);
        }
        return date.getTime();
    }
}
